package o;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.os.Bundle;
import android.view.WindowManager;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;

public abstract class fai extends dex {
    private BroadcastReceiver ˏ = new BroadcastReceiver(this) {
        final /* synthetic */ fai ˏ;

        {
            this.ˏ = r1;
        }

        public void onReceive(Context context, Intent intent) {
            String action = intent.getAction();
            if ("PROTOCOL_CHANGE_BROADCAST".equals(action)) {
                Logger.ˎ("checkNewProtocol", "show protocol_dialog");
                this.ˏ.ʻॱ();
            } else if ("SHOW_TREMS_BROADCAST".equals(action)) {
                Logger.ˎ("checkNewProtocol", "show terms_dialog");
                this.ˏ.ʻॱ();
            }
        }
    };

    public void ˋ(@Nullable Bundle bundle) {
        super.ˋ(bundle);
        fae ˏ = ((faj) cdb.ॱ(faj.class)).ˏ();
        if (ˏ != null) {
            bfm requestParams = ˏ.getRequestParams();
            if (requestParams != null) {
                ˏ(requestParams.ˊ());
            }
        }
    }

    public void B_() {
        super.B_();
        cgk.ˋ("buoyWindow", ccz.ॱ());
        ॱ();
        ʻॱ();
    }

    protected void ʻॱ() {
        if (!ccx.ॱ()) {
            boolean ʼ = dir.ˋ().ʼ();
            Logger.ˎ("checkNewProtocol", "isNeedShowProtocol = " + ʼ);
            if (ʼ) {
                ˎ(ContentManager.getInstant().getContext(), cjl.ˋ("protocol.terms.activity"), new cjm("protocol.terms.activity", null));
            }
        }
    }

    public void C_() {
        super.C_();
        ॱॱ();
    }

    public final void ॱ(@NonNull Context context) {
        ((faj) cdb.ॱ(faj.class)).ˋ(context, this);
    }

    private void ˎ(@NonNull Context context, Class<?> cls, cjm o_cjm) {
        ((faj) cdb.ॱ(faj.class)).ॱ(context, cls, o_cjm);
    }

    private void ॱ() {
        IntentFilter intentFilter = new IntentFilter();
        intentFilter.addAction("PROTOCOL_CHANGE_BROADCAST");
        intentFilter.addAction("SHOW_TREMS_BROADCAST");
        ll.ˏ(ContentManager.getInstant().getContext()).ˏ(this.ˏ, intentFilter);
    }

    private void ॱॱ() {
        ll.ˏ(ContentManager.getInstant().getContext()).ˋ(this.ˏ);
    }

    public WindowManager ˎ(@NonNull Context context) {
        return (WindowManager) context.getApplicationContext().getSystemService("window");
    }
}
